/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pi2.osr.ejb.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.persistence.GenerationType;
import javax.persistence.SequenceGenerator;
import javax.persistence.GeneratedValue;
/**
 *
 * @author admin
 */
@Entity
@Table(catalog = "", schema = "P09713_2_10")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Detalletemporal.findAll", query = "SELECT d FROM Detalletemporal d"),
    @NamedQuery(name = "Detalletemporal.findByIddetalletemporal", query = "SELECT d FROM Detalletemporal d WHERE d.iddetalletemporal = :iddetalletemporal"),
    @NamedQuery(name = "Detalletemporal.findByCantidad", query = "SELECT d FROM Detalletemporal d WHERE d.cantidad = :cantidad")})
public class Detalletemporal implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @SequenceGenerator(name="DETALLETEMPORAL_IDDETALLETEMPORAL_GENERATOR", sequenceName="DETALLETEMPORAL_SEQ", allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="DETALLETEMPORAL_IDDETALLETEMPORAL_GENERATOR")
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false, precision = 0, scale = -127)
    private BigDecimal iddetalletemporal;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private BigInteger cantidad;
    @JoinColumn(name = "IDUSUARIO", referencedColumnName = "IDUSUARIO")
    @ManyToOne(fetch = FetchType.LAZY)
    private Usuario idusuario;
    @JoinColumn(name = "IDPRODUCTO", referencedColumnName = "IDPRODUCTO", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Producto idproducto;

    public Detalletemporal() {
    }

    public Detalletemporal(BigDecimal iddetalletemporal) {
        this.iddetalletemporal = iddetalletemporal;
    }

    public Detalletemporal(BigDecimal iddetalletemporal, BigInteger cantidad) {
        this.iddetalletemporal = iddetalletemporal;
        this.cantidad = cantidad;
    }

    public BigDecimal getIddetalletemporal() {
        return iddetalletemporal;
    }

    public void setIddetalletemporal(BigDecimal iddetalletemporal) {
        this.iddetalletemporal = iddetalletemporal;
    }

    public BigInteger getCantidad() {
        return cantidad;
    }

    public void setCantidad(BigInteger cantidad) {
        this.cantidad = cantidad;
    }

    public Usuario getIdusuario() {
        return idusuario;
    }

    public void setIdusuario(Usuario idusuario) {
        this.idusuario = idusuario;
    }

    public Producto getIdproducto() {
        return idproducto;
    }

    public void setIdproducto(Producto idproducto) {
        this.idproducto = idproducto;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iddetalletemporal != null ? iddetalletemporal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Detalletemporal)) {
            return false;
        }
        Detalletemporal other = (Detalletemporal) object;
        if ((this.iddetalletemporal == null && other.iddetalletemporal != null) || (this.iddetalletemporal != null && !this.iddetalletemporal.equals(other.iddetalletemporal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.pi2.osr.ejb.entites.Detalletemporal[ iddetalletemporal=" + iddetalletemporal + " ]";
    }
    
}
